package com.mvc.interceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author Kirito
 * @description: 拦截器顶层接口，参照spring mvc源码设计，便于扩展。主要目的：拦截请求控制器handler
 * @date 2020/04/09
 */
public interface Interceptor {

    default boolean preHandler(HttpServletRequest req, HttpServletResponse resp, Object handler) throws Exception {
        return true;
    }

    default void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

    }

    default void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler,
                                 Exception ex) throws Exception {
    }
}
